package com.neuralnoise.hibernate.facebook;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Embeddable
public class UserTypeRelationshipId implements java.io.Serializable {

	private static final long serialVersionUID = 2280421028582204433L;

	public enum RelationType { LOCATION, SCHOOL, WORK, LANGUAGE };
	
	private RelationType relation;
    private User user;
    private FacebookType facebookType;

    public UserTypeRelationshipId() { }
    
    public UserTypeRelationshipId(RelationType relation, User user, FacebookType facebookType) {
    	this.relation = relation;
    	this.user = user;
    	this.facebookType = facebookType;
    }
    
	@Column(updatable = false, length = 16)
	public RelationType getRelation() {
		return relation;
	}

	public void setRelation(RelationType relation) {
		this.relation = relation;
	}
	
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user")
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "facebookType")
	public FacebookType getFacebookType() {
		return facebookType;
	}

	public void setFacebookType(FacebookType facebookType) {
		this.facebookType = facebookType;
	}

}
